import { MockMethod } from 'vite-plugin-mock'
export default [
  {
    url: '/mock/login',
    method: 'post',
    response: ({ query }) => {
      return {
        code: 200,
        data: {
          token: 'admin-token'
        },
        message: ''
      }
      // return {
      //   code: 5001,
      //   message: '用户不存在'
      // }
    }
  },
  {
    url: '/mock/getUserInfo',
    method: 'get',
    response: {
      code: 200,
      data: {
        permissions: ["system:user:add", "system:role:query", "system:user:list", "system:user:query"],
        roles: ["admin"],
        user: {
          id: "123",
          username: "1090650726",
          userType: "1",
          avatar: "https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif",
          admin: true
        }
      },
      message: "data"
    }
  },
  {
    url: '/mock/getRouters',
    method: 'get',
    response: ({ query }) => {
      return {
        "code": 200,
        "data": [{
          "name": "Dashboard",
          "path": "/dashboard",
          "hidden": false,
          "redirect": "/dashboard/console",
          "component": "Layout",
          "alwaysShow": true,
          "meta": {
            "title": "Dashboard",
            "icon": "dashboard"
          },
          "children": [{
            "name": "控制台",
            "path": "console",
            "hidden": false,
            "component": "dashboard/console/index",
            "meta": {
              "title": "控制台",
              "icon": "console"
            }
          }, {
            "name": "随便写",
            "path": "suibian",
            "hidden": false,
            "component": "views/suibian ",
            "meta": {
              "title": "随便写"
            }
          }]
        }, {
          "name": "系统管理",
          "path": "/system",
          "hidden": false,
          "redirect": "/system/user",
          "component": "Layout",
          "alwaysShow": true,
          "meta": {
            "title": "系统管理",
            "icon": "system"
          },
          "children": [{
            "name": "用户管理",
            "path": "user",
            "hidden": false,
            "component": "system/user/index",
            "meta": {
              keepAlive: true,
              "title": "用户管理",
              "icon": "person"
            }
          }, {
            "name": "角色管理",
            "path": "role",
            "hidden": false,
            "component": "system/role/index",
            "meta": {
              "title": "角色管理",
              "icon": "eye"
            }
          }, {
            "name": "菜单管理",
            "path": "menu",
            "hidden": false,
            "component": "system/menu/index",
            "meta": {
              "title": "菜单管理",
              "icon": "link"
            }
          }, {
            "name": "字典管理",
            "path": "dict",
            "hidden": false,
            "component": "system/dict/index",
            "meta": {
              "title": "字典管理",
              "icon": "nested"
            }
          }, {
            "name": "公告管理",
            "path": "notice",
            "hidden": false,
            "component": "system/notice/index",
            "meta": {
              "title": "公告管理",
              "icon": "example"
            }
          }, {
            "name": "文件管理",
            "path": "file",
            "hidden": false,
            "component": "system/file/index",
            "meta": {
              "title": "文件管理",
              "icon": "dashboard"
            }
          }, {
            "name": "友情链接管理",
            "path": "link",
            "hidden": false,
            "component": "system/link/index",
            "meta": {
              "title": "友情链接管理",
              "icon": "link"
            }
          }, {
            "name": "轮播图管理",
            "path": "carousel",
            "hidden": false,
            "component": "system/carousel/index",
            "meta": {
              "title": "轮播图管理",
              "icon": "轮播图管理"
            }
          }]
        }, {
          "name": "系统工具",
          "path": "/tool",
          "hidden": false,
          "redirect": "/tool/generate",
          "component": "Layout",
          "alwaysShow": true,
          "meta": {
            "title": "系统工具",
            "icon": "system"
          },
          "children": [{
            "name": "代码生成",
            "path": "generate",
            "hidden": false,
            "component": "tool/generate/index",
            "meta": {
              "title": "代码生成",
              "icon": "form"
            }
          }]
        }, {
          "name": "系统日志",
          "path": "/log",
          "hidden": false,
          "redirect": "/log/loginLog",
          "component": "Layout",
          "alwaysShow": true,
          "meta": {
            "title": "系统日志",
            "icon": "dashboard"
          },
          "children": [{
            "name": "登录日志",
            "path": "loginLog",
            "hidden": false,
            "component": "log/loginLog/index",
            "meta": {
              "title": "登录日志",
              "icon": "table"
            }
          }, {
            "name": "操作日志",
            "path": "operationLog",
            "hidden": false,
            "component": "log/operationLog/index",
            "meta": {
              "title": "操作日志",
              "icon": "example"
            }
          }, {
            "name": "访问日志",
            "path": "visitLog",
            "hidden": false,
            "component": "log/visitLog/index",
            "meta": {
              "title": "访问日志",
              "icon": "user"
            }
          }]
        }, {
          "name": "设置",
          "path": "/setting",
          "hidden": false,
          "redirect": "/setting/personal",
          "component": "Layout",
          "alwaysShow": true,
          "meta": {
            "title": "设置"
          },
          "children": [{
            "name": "个人设置",
            "path": "personal",
            "hidden": false,
            "component": "setting/personal/index",
            "meta": {
              "title": "个人设置"
            }
          }, {
            "name": "系统设置",
            "path": "system",
            "hidden": false,
            "component": "setting/system/index",
            "meta": {
              "title": "系统设置"
            }
          }]
        }, {
          "name": "系统监控",
          "path": "/monitor",
          "hidden": false,
          "redirect": "/monitor/druid",
          "component": "Layout",
          "alwaysShow": true,
          "meta": {
            "title": "系统监控",
            "icon": "link"
          },
          "children": [{
            "name": "数据监控",
            "path": "druid",
            "hidden": false,
            "component": "Iframe",
            "meta": {
              "title": "数据监控",
              "icon": "link",
              "iframeSrc": "http://localhost:8080/dev-api/druid/login.html"
            }
          }, {
            "name": "服务监控",
            "path": "server",
            "hidden": false,
            "component": "monitor/server/index",
            "meta": {
              "title": "服务监控",
              "icon": "link"
            }
          }, {
            "name": "系统接口",
            "path": "swagger",
            "hidden": false,
            "component": "Iframe",
            "meta": {
              "title": "系统接口",
              "icon": "table",
              "iframeSrc": "http://localhost:8080/dev-api/swagger-ui.html"
            }
          }]
        }],
        "message": "操作成功"
      }
    }
  },
  {
    url: '/mock/logout',
    method: 'post',
    response: ({ query }) => {
      return {
        code: 200,
        message: '退出登录成功'
      }
    }
  }

] as MockMethod[]
